package com.sdx.console.transaction.service;

import java.util.List;

import com.sdx.console.transaction.dao.FinTransactionRefundDao;
import com.sdx.console.transaction.entity.FinTransForRefund;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.transaction.dao.FinTransactionDao;
import com.sdx.console.transaction.entity.FinTransaction;
import com.ibeetl.admin.core.service.BaseService;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * FinTransaction Service
 */

@Service
@Transactional
public class FinTransactionService extends BaseService<FinTransaction>{

    @Resource
	private FinTransactionDao finTransactionDao;


    public PageQuery<FinTransaction>queryByCondition(PageQuery query){
        PageQuery ret =  finTransactionDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public PageQuery<FinTransaction>queryVirtualByCondition(PageQuery query){
        PageQuery ret =  finTransactionDao.queryVirtualByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelFinTransaction(List<String> ids){
        try {
            finTransactionDao.batchDelFinTransactionByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除FinTransaction失败", e);
        }
    }

	public FinTransForRefund selectTransForRefund(String transactionId) {
    	FinTransForRefund result = finTransactionDao.selectTransForRefund(transactionId);
		queryEntityAfter(result);
    	return result;
	}

    public FinTransaction selectTranInfoById(String transactionId) {
        return finTransactionDao.selectTranInfoById(transactionId);
    }

    public String selectDictName(String type, Integer value) {
        return finTransactionDao.selectDictName(type, value);
    }


}